/*
 * @Author: caijw 
 * @Date: 2018-11-11 12:54:29 
 * @Last Modified by: caijw
 * @Last Modified time: 2018-12-02 23:39:39
 * 
 * 浏览记录
 */

import React, { Component } from 'react';
import Header from '../../../components/Header/Header';
import { Toast } from 'react-weui';
import { connect } from "react-redux";
import * as actions from '../../../store/action/my';
import {loadMore} from '../../../utils';
import List from '../../views/list/collectionList';
import '../../../static/css/common.less';
import './brower.less';
class Browse extends Component {

    componentDidMount(){
        this.props.getViewList();
        loadMore(this.mainContent,this.props.getViewList);
    }
    render() {
        return (
            <div>
                <div className="detail-region detail-region-brower">
                    <Header title="浏览记录"></Header>
                    <Toast icon="loading" show={this.props.my.fetching}>Loading...</Toast>
                    <section class="content" ref={ref=>this.mainContent=ref}>
                        {this.props.my.view.viewList.length>0?
                            <div className="detail-list">
                                <List listClass='list-col' data={this.props.my.view.viewList}></List>
                            </div>
                        : <div>
                            <div class="no-content">
                                <img src={require('../../../static/images/collection.png')} alt=""></img>
                                </div>
                            <div class="no-more">暂无浏览记录~</div>
                        </div>
                    }
                    </section>
                </div>
            </div>
        )
    }
}

export default connect((state)=>{return {...state}}, actions)(Browse);